package com.ap.core.business.message.response.translators.impl;

import com.ap.core.business.message.domain.translators.BindingMetaData;
import com.ap.core.business.message.response.translators.ResponseMetaData;
import com.ap.core.business.message.response.translators.ResponseTranslator;
import com.ap.core.business.message.response.translators.listener.ResponseListener;
import com.ap.core.cxf.jaxb.common.ActivationStatus;
import com.ap.core.cxf.jaxb.common.UpdateStatus;
import com.ap.core.cxf.jaxb.managemerchant.MerchantRegistResponseType;
import com.ap.core.message.managemerchant.info.RequestMerchantRegistrationTypeInfo;
import com.ap.core.message.managemerchant.info.ResponseMerchantRegistrationTypeInfo;

/**
 * implementation class for {@link com.ap.core.business.message.response.translators.ResponseTranslator} to populate {@link com.ap.core.cxf.jaxb.managemerchant.MerchantRegistResponseType}  in response object
 */
public class ResponseMerchantRegistrationTranslator implements ResponseTranslator<RequestMerchantRegistrationTypeInfo, ResponseMerchantRegistrationTypeInfo> {


    /**
     * {@inheritDoc}
     */
    @Override
    public void populateResponse(RequestMerchantRegistrationTypeInfo request, ResponseMerchantRegistrationTypeInfo response, BindingMetaData bindingMetaData, ResponseMetaData responseMetaData, ResponseListener responseListener) {

        response.setDistributorId(request.getDistributorId());
        final MerchantRegistResponseType merchantRegistResponseType = new MerchantRegistResponseType();
        merchantRegistResponseType.setMerchantId(request.getMerchant().getMerchantId());
        merchantRegistResponseType.setActivationStatus(ActivationStatus.ACTIVE);
        merchantRegistResponseType.setUpdateStatus(UpdateStatus.SUCCESSFUL);
        response.setMerchantRegistResponse(merchantRegistResponseType);
        responseListener.onMessageResponse(response);
    }
    

}
